package com.szr.leex.controller.test;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.szr.leex.controller.BaseController;
import com.szr.leex.dao.test.CourseDao;
import com.szr.leex.po.test.Course;

/**
 * course controller
 * Created by WangChen on 2018/9/12 16:49.
 */
@RestController
@RequestMapping("/course")
public class CourseController extends BaseController {

    @Autowired
    private CourseDao courseDao;


    @RequestMapping("/save")
    public void save(String id){
        Course course = new Course();
        course.setName("语文");
        course.setCode("Chinese");
        courseDao.save(course);
    }

    @RequestMapping("/update")
    public void update(String id, String name, String code){
        Course course = courseDao.getOne(id);
        course.setName(name);
        course.setCode(code);
        courseDao.save(course);
    }
}
